/*
 * =============================================================================
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <eirikb@google.com> wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return Eirik Brandtzæg
 * =============================================================================
 */
package no.eirikb.roboco.telnet;

/**
 *
 * @author eirikb
 * @author <a href="mailto:eirikb@google.com">eirikb@google.com</a>
 */
public class TelnetCommands {

    public static final String CLEAR_SCREEN = (char) 27 + "[2J";
    public static final int FG_COLOR_BLACK = 30;
    public static final int FG_COLOR_RED = 31;
    public static final int FG_COLOR_GREEN = 32;
    public static final int FG_COLOR_BROWN = 33;
    public static final int FG_COLOR_BLUE = 34;
    public static final int FG_COLOR_MAGENTA = 35;
    public static final int FG_COLOR_CYAN = 36;
    public static final int FG_COLOR_WHITE = 37;
    public static final int BG_COLOR_BLACK = 40;
    public static final int BG_COLOR_RED = 41;
    public static final int BG_COLOR_GREEN = 42;
    public static final int BG_COLOR_BROWN = 43;
    public static final int BG_COLOR_BLUE = 44;
    public static final int BG_COLOR_MAGENTA = 45;
    public static final int BG_COLOR_CYAN = 46;
    public static final int BG_COLOR_WHITE = 47;

    public static final String MOVECURSOR(int x, int y) {
        return (char) 27 + "[" + y + ";" + x + "f";
    }

    public static final String ECMA48(int param) {
        return (char) 27 + "[" + param + "m";
    }
    public static final int[] CBREAK = {255, 251, 1, 255, 251, 3};

    public static final String BLANKCHARS(int amount) {
        return (char) 27 + "[" + amount + "X";
    }

    public static final String CLEARRECT(int x, int y, int width, int height) {
        String clear = "";
        for (int i = 0; i <= height; i++) {
            clear += MOVECURSOR(x, y + i);
            clear += BLANKCHARS(width);
        }
        return clear;
    }

    public static final String CLEARCHARS(int length) {
        return (char) 27 + "[" + length + "P";
    }

    public static final String MOVELEFT(int length) {
        return (char) 27 + "[" + length + "D";
    }
}
